package com.apabi.common.config;

import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

import java.util.Map;

public class DynamicDataSource extends AbstractRoutingDataSource {
	@Override
	protected Object determineCurrentLookupKey() {
		return DataSourceContextHolder.getDataSourceType();
	}

	@Override
	public void setTargetDataSources(Map<Object, Object> targetDataSources) {
		System.out.println(targetDataSources);
		super.setTargetDataSources(targetDataSources);
	}
}
